<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:composite="http://java.sun.com/jsf/composite">
<f:view>
	<composite:interface>
		<composite:attribute name="selectButtonRendered" default="false" />
		<composite:attribute name="selectButtonAction"></composite:attribute>
		<composite:attribute name="maqTipo"></composite:attribute>
	</composite:interface>
	<composite:implementation>
		<p:panelGrid styleClass="tableNoGrid" style="width:923px;">
			<p:row>
				<p:column>
					<p:outputLabel value="Tipo de maquina"></p:outputLabel>
				</p:column>
				<p:column width="20px;">
					<p:selectOneMenu id="tipos" value="#{maqMB.selectedTipoMaquina}">
						<p:ajax event="change" update="gantt_col" process="@this" />
						<f:selectItems value="#{maqMB.maquinaTipos}" />
					</p:selectOneMenu>
				</p:column>
				<p:column width="20px;">
					<h:panelGroup id="gantt_col">
						<a class="btn btn-small" href="#"
							onclick="getGanttData(#{maqMB.selectedTipoMaquina.valor});"><i
							class="icon-align-left"></i></a>
					</h:panelGroup>
				</p:column>
				<p:column width="20px;">
					<p:commandButton id="searchMaquinasID"
						actionListener="#{maqMB.searchMaquinasByFilter}" value="Buscar"
						update="maquinasListWraper" process="@this tipos"></p:commandButton>
				</p:column>
				<p:column></p:column>
			</p:row>
		</p:panelGrid>
		<hr></hr>
		<div id="gantt" class="gantt"></div>
		<hr></hr>
		<p:panelGrid id="maquinasListWraper">
			<p:row>
				<p:column>
					<p:dataTable id="#{cc.id}" var="maquina" value="#{maqMB.maquinas}"
						rowKey="#{maquina.id}" selectionMode="single"
						emptyMessage="No existen maquinas registradas"
						filteredValue="#{maquinasMB.maquinasFiltradas}"
						rowsPerPageTemplate="5,10,15" rows="5" paginatorPosition="bottom"
						paginator="true" selection="#{maqMB.selectedMaquina}">
						<p:ajax event="rowSelect" listener="#{maqMB.rowSelected}"
							update="#{cc.attributes.id}" />
						<p:column id="nombreCol" headerText="Codigo">
							<h:outputText value="#{maquina.maqCodigo}" />
						</p:column>
						<p:column id="descCol" headerText="Descripción">
							<h:outputText value="#{maquina.description}" />
						</p:column>
						<p:column id="activoCol" headerText="Activada">
							<p:selectBooleanCheckbox value="#{maquina.isActive}"
								disabled="true"></p:selectBooleanCheckbox>
						</p:column>
						<f:facet name="footer">
							<p:commandButton id="selectButton"
								rendered="#{cc.attributes.selectButtonRendered}" process="@this"
								value="Seleccionar" disabled="#{empty maqMB.selectedMaquina}"
								icon="ui-icon-arrowthick-1-n"
								oncomplete="#{cc.attributes.selectButtonAction}" />
						</f:facet>
					</p:dataTable>
				</p:column>
			</p:row>
		</p:panelGrid>
	</composite:implementation>
</f:view>
</html>